# end: -572
# language: "cn"
# start: -867
# type: "170,116,120,186,54,94,169,81,115,83,124,125"
# x1: 73.91168781662992
# x2: -4.253753628988633
# y1: -160.20799999999954
# y2: 177.29200000000094
# 请求 URL: https://www.allhistory.com/api/timemapNode/getTimemapNodeRecom

import requests
import json

def visit():
    url_map = 'https://www.allhistory.com/map'
    headers = {
        'Accept': 'application / json, text / plain, * / *',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 Edg/89.0.774.50',
    }
    res = requests.get(url_map)
    print(res.status_code)
    print(res.headers)
    # cookies = res.cookies.items()
    # cookie = ''
    # for name, value in cookies:
    #     cookie += '{0}={1};'.format(name, value)
    # return cookie

url = 'https://www.allhistory.com/api/timemapNode/getTimemapNodeRecom'
post_form = {
    'end': -572,
    'language': "cn",
    'start': -867,
    'type': "170,116,120,186,54,94,169,81,115,83,124,125",
    'x1': 73.91168781662992,
    'x2': -4.253753628988633,
    'y1': -160.20799999999954,
    'y2': 177.29200000000094
}
cookie = 'sid=149a722c7958ac17a5cf60575476be6b; ' \
         'UM_distinctid=1782170c97f65a-06e492c410617a-5c3f1d40-144000-1782170c980ac3; ' \
         'sys_lang=zh; aha=WEBmsg8617680245614LOGIN; ' \
         'bearer=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBSDI0NDgzMDc1NzY4NzkiLCJjcmVhdGVkIjoxNjE1NzAwNTUxNTgwLCJleHAiOjE2MjM0NzY1NTEsInVzZXJpZCI6MjQ0ODMwN30.Qh-8Eru5tASv_CX-5_dJ087rEZGJNxKOwVUOhdvy8HO5vrgYziBiiEqYf67VXhrGXIGkKjqf4GjY63XILxnIZQ; ' \
         'free=free; ' \
         'page.prev.id=409vpp3nkm8n2yzi; ' \
         'page.id=409vpp3nkm8qe5fy; ' \
         'refer.url=https%3A%2F%2Fwww.allhistory.com%2Fmap; ' \
         'CNZZDATA1279273237=2089489318-1615466919-%7C1615695418'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 Edg/89.0.774.50',
    'Cookie': cookie,
    'Host': 'www.allhistory.com',
    'Origin': 'https://www.allhistory.com',
    'Referer': 'https://www.allhistory.com/map',
    # '_sid': 'PWT8\Wf|PpP6RWX7\ZP{Q5H4\5\5PGX6QWT6QpMoQpL@',
    'ax':'ed9c671024f2871d226;d50cba16ca627b8eedfe6ba34b965bb3e15e0d5f;f56cee96a2;0ab59b5128908f5ec699e1250ef2b48ea1ca8fdc;1615700558198;2;aaeb771024f2871f0b1;50a91595ca216a7e29ea31041475c5eb0326cd04f24f3d2dcf5d53e8743a6948bb964776f12a3b2d'
}
response = requests.post(url, data=post_form, headers=headers, verify=False)
# history_json = response.text
# history_dict = json.loads(history_json)
# print(history_dict)
# print(history_json)
print(response.status_code)
print(response.headers)
visit()


